<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<#include "../inc/commonJs.html"/>
<title>管理中心</title>
<script type="text/javascript">
var frozenColumns = [ [ {
	field : 'id',
	checkbox : true,
	rowspan : 2
}] ];

// 定义标题栏
var columns = [ [ {
	field : 'title',
	title : '标题',
	width : 180,
	align : 'left'
}, {
	field : 'name',
	title : '栏目',
	align : 'center'
}, {
	field : 'updatetime',
	title : '日期',
	align : 'center'
}, {
	field : 'picnews',
	title : '图片信息',
	align : 'center',
	formatter:function(value,row,index){
		if(value==1){
			return '是';
		}else{
			return '否';
		}
	}
}, {
	field : 'checked',
	title : '审核',
	align : 'center',
	formatter:function(value,row,index){
		if(value==1){
			return '已通过';
		}else{
			return '待审核';
		}
	}
}, {
	field : 'istop',
	title : '置顶',
	align : 'center',
	formatter:function(value,row,index){
		if(value==1){
			return '是';
		}else{
			return '否';
		}
	}
}, {
	field : 'daodu',
	title : '精华',
	align : 'center',
	formatter:function(value,row,index){
		if(value==1){
			return '是';
		}else{
			return '否';
		}
	}
}, {
	field : 'goodnews',
	title : '推荐',
	align : 'center',
	formatter:function(value,row,index){
		if(value==1){
			return '是';
		}else{
			return '否';
		}
	}
} ]];

	function selects(){
		var ids = [];
		var items = $('#checkgrid').datagrid('getSelections');
		if(items.length == 0){
			$.messager.alert("信息提示","请选择信息","error");
			return ;
		}
		for(var i=0; i<items.length; i++){
		    ids.push(items[i].id);	    
		}
		return ids;
	}

	$(function(){
		$('#checkgrid').datagrid({
			fitColumns:true,
			rownumbers : true,
			pagination : true,
			striped : true,
			singleSelect:true,
			loadMsg : '数据装载中......',
	         pageSize: [${syscfg.pageSize!10}],
	         pageList: [${syscfg.pageList!10}],
			toolbar : '#tb',
			url : "myNewsCheck.do",
			idField : 'id', 
			frozenColumns : frozenColumns,
			columns : columns,
			onDblClickRow : doDblClickRow
		});
	});
	// 双击
	function doDblClickRow(rowIndex, rowData) {
		window.parent.open('查看信息','info/newsView.do?newsid='+rowData.id);
	}
	//
	function doView() {
		var item = $('#checkgrid').datagrid('getSelected');
		if(item!=null){
			window.parent.open('查看信息','info/newsView.do?newsid='+item.id);
		}else{
			$.messager.alert("信息提示","查看信息必须选中一行","error");
		}
	}
	//
	function doSearch(){
		var params = {};
		if($('#title').val()){
			params['title'] = $('#title').val();
		}
		if($('#content').val()){
			params['content'] = $('#content').val();
		}
		if($('#author').val()){
			params['author'] = $('#author').val();
		}
		if($('#starttime').datebox('getValue')){
			params['starttime'] = $('#starttime').datebox('getValue');
		}
		if($('#stoptime').datebox('getValue')){
			params['stoptime'] = $('#stoptime').datebox('getValue');
		}
		if($('#type').combotree('getValues')){
			params['typeid'] = $('#type').combotree('getValues').join(",");
		}
		if($('#picnews').combobox('getValue')){
			params['picnews'] = $('#picnews').combobox('getValue');
		}
		if($('#istop').combobox('getValue')){
			params['istop'] = $('#istop').combobox('getValue');
		}
		if($('#goodnews').combobox('getValue')){
			params['goodnews'] = $('#goodnews').combobox('getValue');
		}
		if($('#daodu').combobox('getValue')){
			params['daodu'] = $('#daodu').combobox('getValue');
		}
		if($('#checked').combobox('getValue')){
			params['checked'] = $('#checked').combobox('getValue');
		}
		//alert($('#picnews').combobox('getValue'));
		//
		$('#checkgrid').datagrid('load',params);
	}
	function restore(){
		$('#tb input').val('');
		$('#tb select').val('');
		//$('#checkgrid').datagrid('reload',{});
	}
	
</script>	
</head>
<body>
<div align="center" class="easyui-panel" data-options='fit:true,border:false'>
<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'center',border:true">
	   	<table id="checkgrid" data-options="fit:true,border:false"></table>
	</div>
	<div id="tb"><div style="margin:5">
		&nbsp;&nbsp;标题：<input id="title" type="text">
		&nbsp;&nbsp;内容：<input id="content" type="text">
		&nbsp;&nbsp;作者：<input id="author" type="text">
		&nbsp;&nbsp;开始时间：<input id="starttime" type="text" class="easyui-datebox">
		&nbsp;&nbsp;结束时间：<input id="stoptime" type="text" class="easyui-datebox">
		<br>&nbsp;&nbsp;栏目：<select id="type" class="easyui-combotree" style="width:200px;"  data-options="url:'alltypeTree.do',multiple:true"></select>
		&nbsp;&nbsp;图片：<select id="picnews" name="picnews" panelHeight="50" class="easyui-combobox"><option></option><option value="1">是</option><option value="0">否</option></select>
		&nbsp;&nbsp;推荐：<select id="goodnews" name="goodnews" panelHeight="50" class="easyui-combobox"><option></option><option value="0">否</option><option value="1">是</option></select>
		&nbsp;&nbsp;精华：<select id="daodu" name="daodu" panelHeight="50" class="easyui-combobox"><option></option><option value="0">否</option><option value="1">是</option></select>
		&nbsp;&nbsp;置顶：<select id="istop" name="istop" panelHeight="50" class="easyui-combobox"><option></option><option value="0">否</option><option value="1">是</option></select>
		&nbsp;&nbsp;审核：<select id="checked" name="checked" panelHeight="50" class="easyui-combobox"><option></option><option value="0">否</option><option value="1">是</option></select>
		<a href="javascript: doSearch();" id="button-search" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true">搜索</a>
		<a href="javascript: restore();" id="button-reset" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true">重置</a>
		<a href="javascript: doView();" id="button-view" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true">查看</a>
		</div>
	</div>
</div>
</div>
</body>
</html>